package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.entity.DeviceGroup;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * 设备分组数据访问层
 * 
 * @author system
 * @since 2024-01-01
 */
@Mapper
public interface DeviceGroupMapper extends BaseMapper<DeviceGroup> {
    
    /**
     * 更新设备图片的分组ID
     * 
     * @param oldGroupId 原分组ID
     * @param newGroupId 新分组ID
     * @return 更新记录数
     */
    @Update("UPDATE device_image SET group_id = #{newGroupId}, update_time = NOW() WHERE group_id = #{oldGroupId}")
    int updateDeviceImageGroupId(@Param("oldGroupId") String oldGroupId, @Param("newGroupId") String newGroupId);
} 